]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
calendar: Simplify code a bit
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 12 Jul 2019 03:25:54 +0000 (05:25 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Fri, 12 Jul 2019 18:54:49 +0000 (18:54 +0000)
Just make the error case the same as the no-appointments one.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/626

js/ui/calendar.js

index 01a56baeeaad0d3e445354f37dc879e8fbdbb10a..f1a102505f3464eb6dabfc5a98e7c4037ae72f38 100644 (file)
@@ -237,20 +237,18 @@ var DBusEventSource = class DBusEventSource {
 
     _onEventsReceived(results, error) {
         let newEvents = [];
-        let appointments = results[0] || null;
-        if (appointments != null) {
-            for (let n = 0; n < appointments.length; n++) {
-                let a = appointments[n];
-                let date = new Date(a[4] * 1000);
-                let end = new Date(a[5] * 1000);
-                let id = a[0];
-                let summary = a[1];
-                let allDay = a[3];
-                let event = new CalendarEvent(id, date, end, summary, allDay);
-                newEvents.push(event);
-            }
-            newEvents.sort((ev1, ev2) => ev1.date.getTime() - ev2.date.getTime());
+        let appointments = results[0] || [];
+        for (let n = 0; n < appointments.length; n++) {
+            let a = appointments[n];
+            let date = new Date(a[4] * 1000);
+            let end = new Date(a[5] * 1000);
+            let id = a[0];
+            let summary = a[1];
+            let allDay = a[3];
+            let event = new CalendarEvent(id, date, end, summary, allDay);
+            newEvents.push(event);
         }
+        newEvents.sort((ev1, ev2) => ev1.date.getTime() - ev2.date.getTime());
 
         this._events = newEvents;
         this.isLoading = false;